<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //转为布尔值
      console.log(Boolean("")); //   false空为假;
      console.log(Boolean(" ")); //   true真;
      console.log(Boolean(NaN)); //   false
      console.log(Boolean(null)); //   false
      console.log(Boolean(undefined)); //   false
      console.log(Boolean("小白")); //true
      console.log(Boolean(12)); // true

      //所有的数字都为真,0为假    所有的字符串都为真   '' 空格算字符 为真   其他都为假
    </script>
  </body>
</html>
